<template>
	<view class="pages">
		<view class="goods" v-if="goodList.length!=0">
			<view class="goods_item" v-for="item in goodList" @click="goDetail(item.id)">
				<view class="img">
					<image mode="widthFix" :src="item.mainimg"></image>
				</view>
				<view class="text">{{item.name}}</view>
				<view class="bottom">
					<view class="price">￥{{item.price}}</view>
					<view class="sold">{{item.sales}}{{$t('goods.People')}}</view>
				</view>
			</view>
		</view>
		<view class="no_list" v-else>
			<u-empty :text="$t('general.Text')" mode="search"
				icon="http://cdn.uviewui.com/uview/empty/car.png"></u-empty>
		</view>
		<!-- <view class="goods_item" v-for="item in 1" @click="go('/pages/shop/goodDetail/goodDetail')">
			<view class="img">
				<image mode="widthFix" src="@/static/img/index/bycicle.png"></image>
			</view>
			<view class="text">ICOLOUR公路自行车赛车变速活飞26寸</view>
			<view class="bottom">
				<view class="price">￥513</view>
				<view class="sold">694人付款</view>
			</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		props: ['goodList'],
		data() {
			return {

			}
		},
		methods: {
			goDetail(id) {
				uni.navigateTo({
					url: `/pages/shop/goodDetail/goodDetail?id=${id}`
				})
			},
			go(url) {
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.goods {
		width: 100%;
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;

		.goods_item {
			width: 50%;
			padding: 30rpx 20rpx;
			border: 1rpx solid ghostwhite;

			.img {
				width: 100%;
				height: 260rpx;
				background-color: #fff;
				margin-top: 10rpx;
				margin-bottom: 40rpx;
				display: flex;
				justify-content: center;
				align-items: flex-end;
				overflow: hidden;

				image {
					width: 70%;
				}
			}

			.text {
				height: 80rpx;
				font-size: 26rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
			}

			.bottom {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-top: 5rpx;

				.price {
					font-size: 24rpx;
					font-weight: bold;

				}

				.sold {
					font-size: 24rpx;
					color: #646464;
					margin-left: 40rpx;
					text-align: right;
				}
			}
		}
	}
</style>